// Package coding_round_1 11_75_color
// @Title coding_round_1
// @Description
// @Author  == 琳琳也叫王木木 ==  2021/9/4 13:50
// @Create  2021/9/4 13:50
package coding_round_1

import "fmt"

func SortColors(nums []int) {
	p0, p2 := 0, len(nums)-1
	for i := 0; i <= p2; i++ {
		for ; i <= p2 && nums[i] == 2; p2-- {
			nums[i], nums[p2] = nums[p2], nums[i]
		}
		if nums[i] == 0 {
			nums[i], nums[p0] = nums[p0], nums[i]
			p0++
		}
	}
	fmt.Println(nums)
}
